package cn.ly.link.iterator;

import cn.ly.link.iterator.LinkList;
import cn.ly.link.Node;

public class Iterator<E> {
	
	private Node cur;
	private Node pre;
	private LinkList list;
	
	
	public Iterator(LinkList list){
		this.list = list;
	}
	
	public void reset(){
		cur = list.getFirst();
	}
	
	public boolean atEnd(){
		return cur.next == null;
	}
	
	public void nextNode(){
		pre = cur;
		cur = cur.next;
	}
	
	public Node getCurrent(){
		return cur;
	}
	
	//在迭代器正在访问的节点之后插入一个新的节点
	public void insertAfter(E e){
		Node newNode = new Node(e);
		
	}

}
